<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\Complaints */

$this->title                   = $model->id;
$this->params['breadcrumbs'][] = ['label' => '举报内容', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="complaints-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <?= DetailView::widget([
        'model'      => $model,
        'attributes' => [
            'id',
            'uid',
            'type',
            [
                'attribute' => 'status',
                'value'     => function ($model) {
                    return \common\libs\Constants::getComplaintsStatus($model->status);
                }

            ],
            [
                'label'  => "图片",
                'format' => 'raw',
                'value'  => function ($model) {
                    $res = '';
                    foreach ($model->complaintsImgs as $complaints_img) {
                        $res .= "<img src='" . $complaints_img->image->getImageUrl() . "' width='100px'>" . '<br>';
                    }

                    return $res;
                }
            ],
            'contact_name',
            'contact_phone',
            'content',
            'created_at',
//            'updated_at',
        ],
    ]) ?>

</div>
